package com.itheima.utils;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author tongchen
 * @create 2022-12-22 11:46
 */
@Component
public class CreateIdentify {
    public String createIdentify(String tele){
        //生成随机数并进行两次异或
          Long hash= Long.valueOf(tele.hashCode());
        Long free=2020666L;
        Long server=free^hash;
        Long cur=System.currentTimeMillis();
        Long end = (server ^ cur)%1000000;
        end=end<0?-end:end;
        //定义数组并进行处理
        String [] add={"000000","00000","0000","000","00","0",""};
        String s = end.toString();
        int length = s.length();
        return add[length]+s;

    }
    @Cacheable(value = "smsCode",key = "#tele")
    public String getMsg(String tele){
        return null;
    }

}
